home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / comm / cnet / cn305c_2.lha / support / FidoNet / Method3.examples / TrapCall.rexx < prev    next >
OS/2 REXX Batch file  |  1994-02-13  |  1KB  |  93 lines

  1. /* TrapCall v1.06 2-7-94
  2.  
  3.    This version takes the CNet port OFFLINE without killing it, then runs
  4.    TrapDoor and attempts to call the host system.
  5. */
  6.  
  7.  Options Results
  8.  addlib('rexxsupport.library',0,-30,0)
  9.  
  10.  Address CNetREXX1
  11.  'MODEM 0'
  12.  
  13.  Address command 'CNet:Toss'
  14.  
  15.  Address command 'run TrapDoor'
  16.  Address command 'wait 5'
  17.  
  18.  Address "TrapDoor"
  19.  
  20.  tries=0
  21.  say ''
  22.  say 'Attempting to call Fido HOST...'
  23.  say ''
  24.  
  25.  CLEARLOOP:
  26.    tries=tries+1
  27.    if tries=10 then do
  28.      say ''
  29.      say 'ABORTING.  Unable to command TrapDoor at this time.'
  30.      say ''
  31.      CALL DORETURN
  32.      Exit
  33.    End
  34.  
  35.    call Delay(250)
  36.  
  37.    '@Status S'
  38.    If Result~='IDLE' Then do
  39.      say 'STATUS:' result||'; Trapdoor busy, trying again...'
  40.      call CLEARLOOP
  41.    End
  42.  
  43.  say ''
  44.  
  45.  HOST='1:2410/215.0'
  46.  tries=0
  47.  
  48. CALLHOST:
  49.   tries=tries+1
  50.   if tries=99 then do
  51.     say ''
  52.     say 'Host connection FAILED!'
  53.     say ''
  54.     CALL DORETURN
  55.     exit
  56.   End
  57.   call DOIT
  58.   call CALLHOST
  59.  
  60. DOIT:
  61.   Say 'Clearing Line...'
  62.   'sclear'
  63.   Say 'Line Cleared, Calling...'
  64.   'CALL '||HOST
  65.   'STATUS D'
  66.   if Result='RESULT'Then do
  67.     Say 'Break or FQFA error'
  68.     CALL DORETURN
  69.     Exit
  70.   End
  71.   if Left(Result,7)='CONNECT' Then Do
  72.     say ''
  73.     say 'Host session successful!'
  74.     say ''
  75.     X=RC
  76.     CALL DORETURN
  77.     Exit X
  78.   end  
  79.   Say Result
  80.   'reset'
  81.   CALL DORETURN
  82.   Exit
  83.  
  84.  DORETURN:
  85.  
  86.  'QUIT'
  87.  address command 'wait 5'
  88.  
  89.  Address CNetREXX1
  90.  'MODEM 1'
  91.  
  92. ; return
  93.